package com.nwpu.am.mapper;

import com.nwpu.am.pojo.entity.Knowledge;
import org.apache.ibatis.annotations.*;

import java.util.ArrayList;


@Mapper
public interface KnowledgeMapper {
    @Insert("INSERT INTO tb_knowledge (knowledge_id, type, description) VALUES (#{knowledgeId}, #{type}, #{description})")
    int insertKnowledge(Knowledge knowledge);

    @Select("SELECT * FROM tb_knowledge WHERE knowledge_id = #{knowledgeId}")
    Knowledge selectKnowledgeById(long knowledgeId);

    @Delete("DELETE FROM tb_knowledge WHERE knowledge_id = #{knowledgeId}")
    int deleteKnowledgeById(long knowledgeId);

    @Select("SELECT * FROM tb_knowledge")
    ArrayList<Knowledge> selectAllKnowledge();
}

